from flask import Blueprint
from flask import request
from flask import session

admin_blu = Blueprint('admin',__name__,url_prefix='/admin')

@admin_blu.before_request
def before_request():
    if request.url.endswith('login'):
    # 每次请求前兜进行判断
        user_id= session.get('user_id',None)
        is_admin = session.get('is_admin',False)

        if not user_id:
            return redirect(url_for('admin.admin.login'))


        if not is_admin:
            return ''

        pass

from . import views